package com.jiyun.order.controller;


import com.jiyun.order.service.IFeeInfoService;
import com.jiyun.orders.pojo.FeeInfo;
import com.jiyun.orders.vo.ResultVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 费用信息表 前端控制器
 * </p>
 *
 * @author 1823.
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/fee")
public class FeeInfoController {

    @Autowired
    private IFeeInfoService feeInfoService;

    @Operation(summary = "获取所有费用信息")
    @RequestMapping("/getAllFeeInfo")
    public ResultVo getAllFeeInfo() {
        return ResultVo.ok(feeInfoService.list());
    }

    @Operation(summary = "添加费用信息")
    @PostMapping("/addFeeInfo")
    public ResultVo addFeeInfo(@RequestBody FeeInfo feeInfo) {
        feeInfoService.save(feeInfo);
        return ResultVo.ok();
    }

    @Operation(summary = "费用详情")
    @RequestMapping("/getFeeInfoByOrderId/{id}")
    public ResultVo getFeeInfo(@PathVariable Integer id) {
        FeeInfo feeInfo = feeInfoService.getById(id);
        return ResultVo.ok(feeInfo);
    }
}
